<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <#include "/back/common.html">
    <!--<link rel="stylesheet" href="/back/layui/css/layui.css">-->
    <!--<link rel="stylesheet" href="/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">-->
    <!--<script src="/back/js/jquery.min.js"></script>
    <script src="/back/layui/layui.js"></script>-->
    <!--<script type="text/javascript" src="/zTree/js/jquery.ztree.all.js"></script>-->
    <!--<script type="text/javascript" src="/js/myTree.js"></script>-->
</head>
<body>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>快递信息</legend>
</fieldset>

<form class="layui-form" id="fastMailForm">
    <input type="hidden" id="pk" name="pk" value="${mv.pk}">
    <div class="layui-form-item">
        <label class="layui-form-label">订单号</label>
        <div class="layui-input-inline" style="width:300px;">
            <input type="text" value="${mv.pk}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>

        <label class="layui-form-label">交易流水号</label>
        <div class="layui-input-inline" style="width:300px;">
            <input type="text" value="${mv.serial_number}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">下单时间</label>
        <div class="layui-input-inline">
            <input type="text"  value="${mv.order_time}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">下单人</label>
        <div class="layui-input-inline">
            <input type="text" value="${mv.order_persion_name}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">订单总价</label>
        <div class="layui-input-inline">
            <input type="text" value="${mv.total_price}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">支付时间</label>
        <div class="layui-input-inline">
            <input type="text" value="${mv.pay_time}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">发票抬头</label>
        <div class="layui-input-inline" style="width: 700px;">
            <input type="text"  value="${mv.c5}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">税号</label>
        <div class="layui-input-inline" style="width: 300px;">
            <input type="text" value="${mv.c6}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">公司地址</label>
        <div class="layui-input-inline" style="width: 700px;">
            <input type="text" value="${mv.c7}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">公司电话</label>
        <div class="layui-input-inline" style="width: 300px;">
            <input type="text" value="${mv.c8}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">开户行名称</label>
        <div class="layui-input-inline" style="width: 700px;">
            <input type="text"  value="${mv.c9}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
        <label class="layui-form-label">开户行账号</label>
        <div class="layui-input-inline" style="width: 300px;">
            <input type="text" value="${mv.c10}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">订单备注</label>
        <div class="layui-input-inline" style="width: 1120px;">
            <input type="text" value="${mv.order_remark}" autocomplete="off"
                   class="layui-input" readonly="readonly">
        </div>
    </div>

    <h5 style="color: #FF00FF; margin-left: 20px">注：以下信息请手动填写</h5>
    <br>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"><font color="red">※</font>快递名称</label>
            <div class="layui-input-inline">
                <input type="text" name="c2"  id="c2" value="${mv.c2}"
                       lay-verify="notNull" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><font color="red">※</font>快递单号</label>
            <div class="layui-input-inline">
                <input type="text" name="c1" id="c1" value="${mv.c1}" lay-verify="notNull" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><font color="red">※</font>订单状态</label>
            <div class="layui-input-inline">
                <select id="orderStatus" class="layui-select" name="orderStatus">
                    <option value="2">未发货</option>
                    <option value="5">已发货</option>
                    <option value="6">订单已完成</option>
                </select>
                <script>
                    $("#orderStatus").val("${mv.order_status!2}");
                </script>
            </div>
        </div>
    </div>

    <div class="x-body">
        <table id="thisIsChildTable" class="layui-table" lay-filter="test"></table>
    </div>

    <div class="layui-form-item" style="text-align: center">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="demo1">立即提交</button>
            <!--<button class="layui-btn layui-btn-primary layui-btn-radius" type="reset">重置</button>-->
        </div>
    </div>
</form>
<script>
    var initChildTable;
    layui.use(['form', 'layedit', 'laydate','table'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , table = layui.table;

        initChildTable=function(){
            table.render({
                elem: '#thisIsChildTable'
                ,url:'/order/skuList?orderPk=${mv.pk}'
                ,toolbar: '#toolbarDemo'
                ,title: '产品数据'
                ,cols: [[
                    {type: 'checkbox', fixed: 'left'}
                    ,{field:'product_name', title:'商品名称', fixed: 'left', unresize: true, sort: true}
                    ,{field:'product_pk', title:'商品编号', sort: true}
                    ,{field:'sku_name', title:'商品属性', sort: true}
                    ,{field:'product_price',title:'商品单价', sort: true}
                ]]
                ,page: true
                , response: {
                    statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                }
                , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.message, //解析提示文本
                        "count": res.data.total, //解析数据长度
                        "data": res.data.list //解析数据列表
                    };
                }
            });
        }
        initChildTable();

        //日期
        laydate.render({
            elem: '#birthday'
        });


        //自定义验证规则
        form.verify({
            title: function (value) {
                if (value.length < 5) {
                    return '标题至少得5个字符啊';
                }
            },
            notNull: function (value) {
                if (value.length <= 0) {
                    return '信息必填';
                }
            }
            , password: [
                /^[\w_-]{6,16}$/
                , '密码必须6到12位，且不能出现空格'
            ]
            , email: [
                /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
                , '密码必须6到12位，且不能出现空格'
            ]
            , phone: [
                /^[1][2,3,4,5,6,7,8,9][0-9]{9}$/
                , '手机号码格式异常'
            ]
            , account: [
                /^[A-Za-z0-9]{4,16}$/
                , '请输入4位以上的英文或数字组合'
            ]
            , content: function (value) {
                layedit.sync(editIndex);
            }
        });

        //监听提交
        form.on('submit(demo1)', function (data) {
            layui.use(['jquery'], function () {
                var $ = jQuery = layui.$;
                var postUrl = "/order/update";
                $.ajax({
                    url: postUrl,
                    type: 'post',
                    data: $("#fastMailForm").serialize(),
                    success: function (resp) {
                        layer.msg(resp.message);
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                        parent.initTable();//刷新表格数据
                    },
                    error: function (resp) {
                        layer.msg(resp.message);
                    }
                });
            });
            return false;
        });
    });
</script>

</body>
</html>